package com.eddie.strategy.improve;

import lombok.Data;

/**
 * @author Eddie
 * @date 2022/08/08 13:44
 **/
@Data
public abstract class Duck {

    /**
     * 属性，策略接口
     */
    private FlyBehavior flyBehavior;
    //其他属性<->策略接口


    public Duck() {

    }

    public void quack() {
        System.out.println("鸭子嘎嘎叫~~~");
    }

    public void swim() {
        System.out.println("鸭子会游泳~~~");
    }

    public void fly() {
        if (flyBehavior != null) {
            flyBehavior.fly();
        }
    }

    /**
     * 显示鸭子信息
     */
    public abstract void display();
}
